package com.ysxsoft.wdg.widget;

import android.os.CountDownTimer;
import android.widget.TextView;

public class TimeCount extends CountDownTimer {

    private TextView view;

    public TimeCount(long millisInFuture, long countDownInterval, TextView view) {
        super(millisInFuture, countDownInterval);//参数依次为总时长,和计时的时间间隔
        this.view = view;
    }

    @Override
    public void onFinish() {//计时完毕时触发
        view.setText("重新验证");
        view.setClickable(true);
    }

    @Override
    public void onTick(long millisUntilFinished) {//计时过程显示
        view.setClickable(false);
        view.setText(millisUntilFinished / 1000 + "秒");
    }
}
